package util;

public class SetPriority<T> implements Comparable<SetPriority<T>> {
    private int priority_normal=100;
    private T object;
    public T getObject() {
        return object;
    }
    public void setObject(T object) {
        this.object = object;
    }

    public int getPriority_normal() {
        return priority_normal;
    }

    public void setPriority_normal(int priority_normal) {
        this.priority_normal = priority_normal;
    }
    public void addPriorityLevel1(int priority){
        this.priority_normal+=priority;
    }
    public void addPriorityLevel2(int priority){
        this.priority_normal+=(priority*2);
    }
    public void addPriorityLevel3(int priority){
        if (priority_normal==0){
            priority_normal=1;
        }
        if(priority==1){
            priority=priority+1;
        }
        this.priority_normal*=priority;
    }

    public void declinePriorityLevel1(int priority){
        this.priority_normal-=priority;
        if(priority_normal<0){
            priority_normal=0;
        }
    }
    public void declinePriorityLevel2(int priority){
        this.priority_normal-=(priority*2);
        if(priority_normal<0){
            priority_normal=0;
        }
    }
    public void declinePriorityLevel3(int priority){
        if(priority==1){
            priority=priority+1;
        }
        this.priority_normal/=priority;
        this.priority_normal-=1;
        if(priority_normal<0){
            priority_normal=0;
        }
    }

    @Override
    public int compareTo(SetPriority<T> o) {
        return priority_normal> o.getPriority_normal() ? -1 : (priority_normal== o.getPriority_normal() ? 0 : 1);
    }
}
